<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://struts.apache.org/tags-html-el" prefix="html" %>
<%@ taglib uri="http://amc.af.mil/portal-el" prefix="portal" %>
<%@ taglib uri="http://amc.af.mil/radtaglibrary" prefix="rad" %>
<html>
<head>
    <title>Assign Equipment To Person</title>

</head>

<body>
<rad:useBean id="userViewHelper"/>
<rad:useBean id="equipmentItemViewHelper"/>
<rad:useBean id="organizationViewHelper"/>

<div id="portal-left-bar">
    <jsp:include page="../navigation/navigationMenu.jsp"/>
</div>

<div id="portal-content">
    <portal:box title="Assign Equipment To User">
        <!-- TODO: Filter displayed users by their assigned organization -->
        <table>
            <tr>
                <td>
                    <html:form method="post" action="organizationAction.do?method=changeDefaultOrganization">
                        <html:select property="organizationId">
                            <html:optionsCollection name="organizationViewHelper"
                                                    property="all"
                                                    label="name"
                                                    value="id"/>
                        </html:select>
                    </html:form>
                </td>
            </tr>
            <tr>
                <td>
                    <html:form method="post" action="userAction.do?method=assignEquipmentToUser">
                    <html:select property="userId" size="10">
                        <html:optionsCollection name="userViewHelper"
                                                filter="false"
                                                property="all"
                                                label="displayName"
                                                value="id"/>
                    </html:select>
                    <!-- TODO: Filter out equipment already assigned to user -->
                    <html:select property="itemId"
                                 size="10"
                                 multiple="multiple">
                        <html:optionsCollection name="equipmentItemViewHelper"
                                                filter="false"
                                                property="all"
                                                label="serial"
                                                value="id"/>

                    </html:select>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <html:submit title="Assign Equipment"/>
                </td>
            </tr>
            </html:form>

        </table>
    </portal:box>
</div>
</body>
</html>